import axios from 'axios'
import DataUtil from '../common/dataUtil'

const baseURL = 'http://23.235.147.112:8081/';
const baseURL3 = 'http://23.235.147.225:8091/'; 
// const baseURL = 'http://mifengm.rxftpb.cn/manages'//线上
// export const formData = new FormData();

axios.defaults.baseURL = baseURL;

//添加请求拦截器
axios.interceptors.request.use(function (request) {
    //将token给到一个前台约定好的key中，作为请求发送
    var sessionId = DataUtil.sid();
    if(sessionId){
        request.url += '?sessionId='+DataUtil.sid();
    }else{
        request.url += '?sessionId='+null;
    }
    
    return request
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);
  });

//////////////////////////////////登录接口//////////////////////////////////
export const checkUser = params =>{
    return axios.post('merchantcontroller/merchantUser/loginByPwd',params).then(res => res.data)
}
//修改密码接口
export const sysUserPass = params =>{
    return axios.post('merchantcontroller/merchantUser/setNewPwd',params).then(res => res.data)
}
///////获取短信验证码
export const getSmscode = params =>{
    return axios.post('merchantcontroller/merchantUser/getCode',params).then(res => res.data)
}
////////注册
export const regist = params =>{
    return axios.post('merchantcontroller/merchantUser/register',params).then(res => res.data)
}
///////////商户列表  
export const getUserList = params =>{
    return axios.post('merchantcontroller/merchantUser/selectMerchants',params).then(res => res.data)
}
//////////商户白名单列表   
export const getUserWhiteList = params =>{
    return axios.post('merchantcontroller/merchantWhite/selectMerchantWhite',params).then(res => res.data)
}
//////////修改商户白名单   
export const resetUserWhiteList = params =>{
    return axios.post('merchantcontroller/merchantWhite/updateMerchantWhite',params).then(res => res.data)
}
////////////添加白名单
export const addUserWhiteList = params =>{
    return axios.post('merchantcontroller/merchantWhite/insertMerchantWhite',params).then(res => res.data)
}
//////////删除商户白名单
export const removeUserWhiteList = params =>{
    return axios.post('merchantcontroller/merchantWhite/deleteMerchantWhite',params).then(res => res.data)
}
//////////根据id获取密钥
export const getSecretById = params =>{
    return axios.post('merchantcontroller/merchantSecret/selectMerchantSecretById',params).then(res => res.data)
}
//////////修改密钥
export const resetSecretList = params =>{
    return axios.post('merchantcontroller/merchantSecret/updateMerchantSecret',params).then(res => res.data)
}
/////////////商户订单列表   
export const getMerchantOrderList = params =>{
    return axios.post('merchantcontroller/merchantOrder/selectMerchantOrder',params).then(res => res.data)
}
/////////////修改商户订单列表   
export const resetMerchantOrderList = params =>{
    return axios.post('merchantcontroller/merchantOrder/updateMerchantOrder',params).then(res => res.data)
}
//////////获取商户资产列表
export const getMerchantAsset = params =>{
    return axios.post('merchantcontroller/merchantAsset/selectMerchantAsset',params).then(res => res.data)
}
///////////根据商户id获取商户资产
export const getMerchantAssetById = params =>{
    return axios.post('merchantcontroller/merchantAsset/selectMerchantAssetById',params).then(res => res.data)
}
////////////获取商户流水列表
export const getMerchantFlow = params =>{
    return axios.post('merchantcontroller/merchantTurnover/selectMerchantTurnover',params).then(res => res.data)
}
///////////获取商户资产申请列表
export const getMerchantAssetApplyList = params =>{
    return axios.post('merchantcontroller/merchantMoneyApply/selectMerchantMoneyApply',params).then(res => res.data)
}
///////////添加商户资产申请
export const addMerchantAssetApply = params =>{
    return axios.post('merchantcontroller/merchantMoneyApply/insertMerchantMoneyApply',params).then(res => res.data)
}
///////////审核商户资产申请
export const ReviewMerchantAssetApply = params =>{
    return axios.post('merchantcontroller/merchantMoneyApply/updateMerchantMoneyApply',params).then(res => res.data)
}
export const UnderwriterPayCollect = params =>{
    return axios.post(baseURL3+'acceptor/acceptor/user/code-list',params).then(res => res.data)
}